import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_shop/cons/global_cons.dart';
import 'package:flutter_shop/pages/home/home_router.dart';
import 'package:flutter_shop/pages/home/home_tab_page/entity/home_content_data.dart';
import 'package:flutter_shop/res/colors.dart';
import 'package:flutter_shop/routers/navigator_utils.dart';
import 'package:flutter_shop/widget/load_image.dart';

class FloorPics extends StatelessWidget {
  BuildContext context;
  final List<HomeContentDataFloor> floorPics;

  FloorPics({Key key, this.floorPics}) : super(key: key);

  Widget _picTap(HomeContentDataFloor floor) {
    return Container(
      decoration: BoxDecoration(
          border: Border(
        left: BorderSide(width: 0.5, color: CommonColors.common_divide_line),
        top: BorderSide(width: 0.5, color: CommonColors.common_divide_line),
        right: BorderSide(width: 0.5, color: CommonColors.common_divide_line),
        bottom: BorderSide(width: 0.5, color: CommonColors.common_divide_line),
      )),
      child: InkWell(
        onTap: () {
          NavigatorUtils.push(context, HomeRouter.goodDetail, params: {GlobalCons.KEY_ID: floor.goodsId});
        },
        child: LoadImage(floor.image),
      ),
    );
  }

  Widget _left() {
    return Container(
      width: ScreenUtil().setWidth(375),
      child: Column(
        children: <Widget>[
          _picTap(floorPics[0]),
          _picTap(floorPics[1]),
        ],
      ),
    );
  }

  Widget _right() {
    return Container(
      width: ScreenUtil().setWidth(375),
      child: Column(
        children: <Widget>[
          _picTap(floorPics[2]),
          _picTap(floorPics[3]),
          _picTap(floorPics[4]),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    this.context = context;

    return Container(
      child: Row(
        children: <Widget>[
          _left(),
          _right(),
        ],
      ),
    );
  }
}
